package arithmetic;

/**
 * 数组元素的查找
 * @author: yyfei  
 * @email:  yyfei123@qq.com
 */
public class ArraySearch {
	public static void main(String[] args) {
		String[] arr = new String[] { "AA", "BB", "CC", "DD" };
		//线性查找
		String search="DD";
		for (int i = 0; i < arr.length; i++) {
			if(search.equals(arr[i])) {
				System.out.println(i);
				break;
			}
		}
		
		
		//二分法查找：需要有序的数组才能使用二分法，不然没得效果
		
		
		
		
		
		
	}
}
